home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
ARASAN_S.ZIP
/
MOVEARR.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-03
|
2KB
|
95 lines
// Copyright 1993 by Jon Dart. All Rights Reserved.
#ifndef _MOVE_ARRAY_H
#define _MOVE_ARRAY_H
#include "board.h"
#include "emove.h"
#include "array.h"
class Move_Array;
class Move_Record
{
// holds info on a move made during the game or during a search
// operation.
public:
Move_Record(const Board &board, const ExtendedMove &move);
// "board" is the board position after the move.
Move_Record();
// create a null record. Used only to initialize storage.
~Move_Record()
{
}
const ExtendedMove &move() const
{
return my_move;
}
const unsigned long hashcode() const
{
return my_hashcode;
}
int operator == ( const Move_Record &l ) const;
int operator != ( const Move_Record &l ) const;
private:
ExtendedMove my_move;
unsigned long my_hashcode;
Board::CastleType my_caststat[2];
};
class Move_Array : public Array<Move_Record>
{
// Maintains a list of moves made in the game so far or in
// the search process.
public:
Move_Array();
// create a Move_Array.
virtual ~Move_Array();
void add_move( const Board &board, const ExtendedMove &emove );
// add a move to the Move_Array. "board" is the position after the
// move is made.
void remove_move();
// remove the most recently added move to the Move_Array.
// return the total number of half-moves in the game:
unsigned num_moves() const
{
return size();
}
unsigned num_moves(const ColorType side);
const ExtendedMove &move( const unsigned n );
// return the nth move in the Move_Array. 0 <= n <= num_moves - 1.
int rep_count( const Board &board) const;
// returns a repetition count: how many times the board position
// has occurred in the game.
void clear();
// remove everything from the Move_Array
private:
enum {Rep_Table_Size = 128};
int rep_table[Rep_Table_Size];
};
#endif